package com.fengniu.ejb.business;

import java.util.List;
import java.util.Map;

import com.fengniu.ejb.entity.Content;
import com.fengniu.ejb.entity.DeltaRelation;
import com.fengniu.ejb.entity.Site;
import com.fengniu.ejb.entity.Site2Site;
import com.fengniu.ejb.entity.TagLog;
import com.fengniu.ejb.entity.User2Content;
import com.fengniu.ejb.entity.User2Site;
import com.fengniu.ejb.entity.User2User;

public interface IUserBusiness {
	/**
	 * find user managed store,every user has only one managed store
	 * 
	 * @param userSysId
	 * @return Site
	 */
	public Site findUserManagedStore(long userSysId);

	public User2Site findUserManagedHorde(long userSysId, long siteSysId);

	/**
	 * find store servant, every store only has a servant
	 * 
	 * @param siteSysId
	 * @return
	 */
	public User2Site findStoreServant(long siteSysId);

	/**
	 * find product servant, every product only has a servant
	 * 
	 * @param contentSysId
	 * @return
	 */
	public User2Content findProductServant(long contentSysId);

	public User2Site findUserHomeHorde(long userSysId);

	public User2Site findUserManagedWebSite(long userSysId);

	/**
	 * 
	 * @param userSysId
	 * @param webSiteId
	 * @return
	 */
	public User2Site findUserServedWebSite(long userSysId, String webSiteId);

	/**
	 * save user managed store,every user has only one managed store
	 * 
	 * @param userSysId
	 * @param site
	 * @param initStorePositionCategoryId
	 */
	public void saveUserManagedStore(long userSysId, Site site, String initStorePositionCategoryId);

	/**
	 * 
	 * @param userSysId
	 * @param site
	 * @param initWebSitePositionCategoryId
	 */
	public void saveUserManagedWebSite(long userSysId, Site site, String initWebSitePositionCategoryId);

	/**
	 * save user served website
	 * 
	 * @param userSysId
	 * @param webSite
	 * @param initWebSitePositionCategoryId
	 */
	public void saveUserServedWebSite(long userSysId, Site webSite, String initWebSitePositionCategoryId);

	public void saveUserManagedHorde(long userSysId, Site site, String initStorePositionCategoryId);

	public void setUserHomeHorde(long userSysId, long siteSysId);

	/**
	 * find user managed store,every user has only one managed company
	 * 
	 * @param userSysId
	 * @return Site
	 */
	public Site findUserManagedCompany(long userSysId);

	/**
	 * save user managed store,every user has only one managed company
	 * 
	 * @param userSysId
	 * @param site
	 * @param initStorePositionCategoryId
	 */
	public void saveUserManagedCompany(long userSysId, Site site);

	/**
	 * update user sale products information and relations to delegated stores
	 * 
	 * @param user2Content
	 * @param delegatedStoreSysIds
	 */
	public void updateUserSaleContents(User2Content user2Content, long[] delegatedStoreSysIds);

	/**
	 * create user 2 coupon relations
	 * 
	 * @param userSysId
	 * @param id
	 * @param contentSysIds
	 */
	public void addUser2Contents(long userSysId, Integer relationId, long[] contentSysIds);

	/**
	 * create user 2 coupon relations
	 * 
	 * @param userId
	 * @param id
	 * @param contentIds
	 */
	public void addUser2Contents(String userId, Integer relationId, String[] contentIds);

	/**
	 * delete user 2 coupon relations
	 * 
	 * @param userSysId
	 * @param id
	 * @param contentSysIds
	 */
	public void deleteUser2Contents(long userSysId, Integer relationId, long[] contentSysIds);

	/**
	 * add user favorite product
	 * 
	 * @param userSysId
	 * @param contentSysId
	 */
	public void addUserFavoriteProduct(long userSysId, long contentSysId);

	/**
	 * add user favorite Store
	 * 
	 * @param userSysId
	 * @param siteSysId
	 */
	public void addUserFavoriteStore(long userSysId, long siteSysId);

	/**
	 * add user favorite Horde
	 * 
	 * @param userSysId
	 * @param siteSysId
	 */
	public void addUserFavoriteHorde(long userSysId, long siteSysId);

	/**
	 * add user favourite Website
	 * 
	 * @param userSysId
	 * @param siteSysId
	 */
	public void addUserFavoriteWebSite(long userSysId, long siteSysId);

	/**
	 * add user favorite Company
	 * 
	 * @param userSysId
	 * @param siteSysId
	 */
	public void addUserFavoriteCompany(long userSysId, long siteSysId);

	/**
	 * delete user favorite product
	 * 
	 * @param userSysId
	 * @param contentSysId
	 */
	public void deleteUserFavoriteProduct(long userSysId, long contentSysId);

	/**
	 * delete user favorite Store
	 * 
	 * @param userSysId
	 * @param siteSysId
	 */
	public void deleteUserFavoriteStore(long userSysId, long siteSysId);

	public void deleteUserFavoriteWebSite(long userSysId, long siteSysId);

	/**
	 * delete user favorite Company
	 * 
	 * @param userSysId
	 * @param siteSysId
	 */
	public void deleteUserFavoriteCompany(long userSysId, long siteSysId);

	/**
	 * get page of user favorite products
	 * 
	 * @param userSysId
	 * @param contentSysId,-1
	 *            all,>0 specified coupon
	 * @param pgno
	 * @param pgsize
	 * @return
	 */
	public List<User2Content> getListUserFavoriteProduct(long userSysId, long contentSysId, int pgno, int pgsize);

	/**
	 * get page of user float books
	 * 
	 * @param userSysId
	 * @param contentSysId
	 * @param pgno
	 * @param pgsize
	 * @return
	 */
	public List<User2Content> getListUserFloatBook(long userSysId, long contentSysId, int pgno, int pgsize);

	/**
	 * get page of user favorite stores
	 * 
	 * @param userSysId
	 * @param siteSysId
	 * @param pgno
	 * @param pgsize
	 * @return
	 */
	public List<User2Site> getListUserFavoriteStore(long userSysId, long siteSysId, int pgno, int pgsize);

	/**
	 * 
	 * @param userSysId
	 * @param siteSysId
	 * @param pgno
	 * @param pgsize
	 * @return map contains list user2SiteList,Long totalCount
	 */
	public Map<String, Object> getUserServedStores(long userSysId, long siteSysId, int pgno, int pgsize);

	/**
	 * 
	 * @param userSysId
	 * @param contentSysId
	 * @param pgno
	 * @param pgsize
	 * @return map contains list user2ContentList,Long totalCount
	 */
	public Map<String, Object> getUserServedProducts(long userSysId, long contentSysId, int pgno, int pgsize);

	/**
	 * 
	 * @param userSysId
	 * @param webSiteSysId
	 * @param pgno
	 * @param pgsize
	 * @return map contains list user2SiteList,Long totalCount
	 */
	public Map<String, Object> getUserServedWebSites(long userSysId, long webSiteSysId, int pgno, int pgsize);

	/**
	 * get page of user favourite hordes
	 * 
	 * @param userSysId
	 * @param siteSysId
	 * @param pgno
	 * @param pgsize
	 * @return
	 */
	public List<User2Site> getListUserFavoriteHorde(long userSysId, long siteSysId, int pgno, int pgsize);

	/**
	 * get page of user favourite websites
	 * 
	 * @param userSysId
	 * @param siteSysId
	 * @param pgno
	 * @param pgsize
	 * @return
	 */
	public List<User2Site> getListUserFavoriteWebSite(long userSysId, long siteSysId, int pgno, int pgsize);

	/**
	 * get page of user favorite stores
	 * 
	 * @param userSysId
	 * @param siteSysId
	 * @param pgno
	 * @param pgsize
	 * @return
	 */
	public List<User2Site> getListUserFavoriteCompany(long userSysId, long siteSysId, int pgno, int pgsize);

	/**
	 * save request of user to the company for product information
	 * 
	 * @param userSysId
	 * @param user2Site
	 */
	public void saveUserCompanyProductRequest(long userSysId, User2Site user2Site);

	/**
	 * get user coupon's delegated stores
	 * 
	 * @param user2ContentSysId
	 * @param pgno
	 * @param pgsize
	 * @return
	 */
	// public List<Site2User_Content> getListUser2ContentDelegatedSite(long
	// user2ContentSysId, int pgno, int pgsize);
	/**
	 * save user posted message,create user2content relation and published the
	 * message to sites identified by post2SiteSysIds
	 * 
	 * @param userSysId
	 * @param coupon
	 * @param post2SiteSysIds
	 */
	public void saveUserPostMessage(long userSysId, Content content, long[] post2SiteSysIds);

	/**
	 * save user float book information
	 * 
	 * @param userSysId
	 * @param user2Content
	 * @param floatInSiteSysIds
	 */
	public void saveUserFloatBook(long userSysId, User2Content user2Content, long[] floatInSiteSysIds);

	/**
	 * save user served product, if the coupon is new created then create
	 * Site2Content and Content2Category(of contentCategory) and
	 * Content2Category(of brandCategory) else only need to save coupon
	 * 
	 * @param userSysId
	 * @param coupon
	 * @param contentCategoryId
	 * @param brandCategoryId
	 */
	public void saveUserServedProduct(long userSysId, Content content, String contentCategoryId, String brandCategoryId);

	/**
	 * get user posted messages
	 * 
	 * @param userSysId
	 * @param pgno
	 * @param pgsize
	 * @return
	 */
	public List<User2Content> getListUserPostMessage(long userSysId, int pgno, int pgsize);

	/**
	 * 
	 * @param siteSysId
	 * @param pgno
	 * @param pgsize
	 * @return
	 */
	public List<DeltaRelation> getListSiteUserFloatBook(long siteSysId, int pgno, int pgsize);

	/**
	 * 
	 * @param userSysId
	 * @param delta
	 *            holds user input "name,longDesc"
	 * @param user2ContentSysId
	 *            represented a user2floatbook
	 */
	public void saveUserFloatBookRepliedMessage(long userSysId, DeltaRelation delta, long user2ContentSysId);

	/**
	 * 
	 * @param user2ContentSysId
	 * @param pgno
	 * @param pgsize
	 * @return
	 */
	public List<DeltaRelation> getlistUserFloatBookRepliedMessage(long user2ContentSysId, int pgno, int pgsize);

	/**
	 * 
	 * @param userSysId
	 * @param site2Site
	 * @return
	 */
	public Site2Site saveUserHorde2Store(long userSysId, Site2Site site2Site);

	/**
	 * 
	 * @param userSysId
	 * @return
	 */
	public User2User findUserRecommender(long userSysId);

	/**
	 * 
	 * @param userSysId
	 * @return
	 */
	public List<User2User> getListUserRecommendee(long userSysId);

	/**
	 * 
	 * @param userSysId
	 */
	public void resetUserRecommender(long userSysId);

	/**
	 * 
	 * @param recommenderSysId
	 * @param userSysId
	 * @return
	 */
	public User2User setUserRecommender(long recommenderSysId, long userSysId);

	/**
	 * 
	 * @param siteSysId
	 * @param userId
	 * @return
	 */
	public User2Site requestStoreServant(long siteSysId, String userId);

	/**
	 * 
	 * @param userSysId
	 * @param user2SiteSysId
	 * @return
	 */
	public User2Site approve2BeStoreServant(long userSysId, long user2SiteSysId);

	/**
	 * approve store to change store's status and the shortdesc of user2Site
	 * 
	 * @param userSysId
	 * @param user2Store
	 * @return
	 */
	public User2Site approveUserServedStore(long userSysId, User2Site user2Store);
	
	/**
	 * save user tag log 
	 * 
	 * @param userSysId
	 * @param tagLog
	 * @return
	 */
	public TagLog saveTagLog(long userSysId,TagLog tagLog);
}
